package ar.edu.itba.it.cg.grupo01.game.action;

import ar.edu.itba.it.cg.grupo01.vehicle.Car;
import com.jme.input.action.InputActionEvent;
import com.jme.input.action.InputActionInterface;

public class SteerAction implements InputActionInterface {
    Car car;

    int direction;

    public SteerAction(Car car, int direction) {
        this.car = car;
        this.direction = direction;
    }

	public void setCar(Car car) {
		this.car = car;
	}



	public void performAction(final InputActionEvent e) {
        // If the key is down (left or right) lets steer
        if (e.getTriggerPressed()) {
            car.steer(direction);
        }
        // If it's up, lets unsteer
        else {
            car.unsteer();
        }
    }

}